﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;

using QLTTAN.DTO;
namespace QLTTAN.DAL
{
    public class TrinhDoTienQuyetDAL
    {
        ConnectionData conn;

        public DataTable TrinhDoTienQuyet_Load(TrinhDoTienQuyetDTO TDTQ_DTO)
        {
            conn = new ConnectionData();

            int Nparameter = 1;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];

            name[0] = "MaTrinhDo";
            value[0] = TDTQ_DTO.MaTrinhDo;

            return conn.GetData("TRINHDOTIENQUYET_LOAD_MaTrinhDo", name, value, Nparameter);
        }

        public int TrinhDoTienQuyet_Insert(TrinhDoTienQuyetDTO TDTQ_DTO)
        {
            conn = new ConnectionData();

            int Nparameter = 2;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];

            name[0] = "MaTrinhDo";
            value[0] = TDTQ_DTO.MaTrinhDo;
            name[1] = "MaTrinhDoTienQuyet";
            value[1] = TDTQ_DTO.MaTrinhDoTienQuyet;

            return conn.UpdateData("TRINHDOTIENQUYET_INSERT", name, value, Nparameter);
        }

        public int TrinhDoTienQuyet_Update(TrinhDoTienQuyetDTO TDTQ_DTO)
        {
            conn = new ConnectionData();

            int Nparameter = 2;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];

            name[0] = "MaTrinhDo";
            value[0] = TDTQ_DTO.MaTrinhDo;
            name[1] = "MaTrinhDoTienQuyet";
            value[1] = TDTQ_DTO.MaTrinhDoTienQuyet;


            return conn.UpdateData("TRINHDOTIENQUYET_UPDATE", name, value, Nparameter);
        }

        public int TrinhDoTienQuyet_Delete(TrinhDoTienQuyetDTO TDTQ_DTO)
        {
            conn = new ConnectionData();

            int Nparameter = 2;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];


            name[0] = "MaTrinhDo";
            value[0] = TDTQ_DTO.MaTrinhDo;
            name[1] = "MaTrinhDoTienQuyet";
            value[1] = TDTQ_DTO.MaTrinhDoTienQuyet;


            return conn.UpdateData("TRINHDOTIENQUYET_DELETE", name, value, Nparameter);
        }
    }
}
